<!DOCTYPE html>
<meta charset="UTF-8">
<div style="margin:40px 100px 0 20px">
<form action="save" method="post" class="layui-form">
	<input type="hidden" name="id" data-th-value="${model.id}">
	<input type="hidden" name="parentId" data-th-value="${model.parent==null?null:model.parent.id}">
	<div data-th-if="${model.parentId==0}" >
		<div class="layui-form-item" >
			<label class="layui-form-label">名称：</label>
			<div class="layui-input-block">
				<input type="text" name="name" data-th-value="${model.name}" id="name" class="layui-input" placeholder="请输入权限名称" />
			</div>
		</div>
	
		<div class="layui-form-item">
			<label class="layui-form-label">代码：</label>
			<div class="layui-input-block">
				<input type="text" name="code" data-th-value="${model.code}"id="code" class="layui-input" placeholder="请输入代码" />
			</div>
		</div>
	</div>
	<div data-th-if="${model.parentId != 0}">
		<div class="layui-form-item">
	   		<label class="layui-form-label">权限：</label>
	   		<div class="layui-input-block">
				<select name="permissionCode" lay-search>
					<option value="" style="display: none;"></option>
					<option th:each="role:${roles}" th:value="${role.code}"th:text="${role.name}" th:selected="${role.code==model.code}"></option>
				</select>
	   		</div>
	 	</div>
	 </div>
	<div class="layui-form-item">
		<label class="layui-form-label">排序：</label>
		<div class="layui-input-block">
			<input type="text" name="idx1" data-th-value="${model.idx1}" class="layui-input" placeholder="请输入排序顺序" />
		</div>
	</div>
</form>
</div>
<script type="text/javascript">
	form = layui.form;
	form.render('select');
</script>